package com.ruoyi.weixin.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.weixin.domain.WxAutoReply;
import com.ruoyi.weixin.mapper.WxAutoReplyMapper;
import com.ruoyi.weixin.service.IWxAutoReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 微信自动回复Service业务层处理
 *
 * @author dqianhe
 * @date 2022-04-27
 */
@Service
public class WxAutoReplyServiceImpl implements IWxAutoReplyService {
    @Autowired
    private WxAutoReplyMapper wxAutoReplyMapper;

    /**
     * 查询微信自动回复
     *
     * @param id 微信自动回复主键
     * @return 微信自动回复
     */
    @Override
    public WxAutoReply selectWxAutoReplyById(String id) {
        return wxAutoReplyMapper.selectWxAutoReplyById(id);
    }

    /**
     * 查询微信自动回复列表
     *
     * @param wxAutoReply 微信自动回复
     * @return 微信自动回复
     */
    @Override
    public List<WxAutoReply> selectWxAutoReplyList(WxAutoReply wxAutoReply) {
        return wxAutoReplyMapper.selectWxAutoReplyList(wxAutoReply);
    }

    /**
     * 新增微信自动回复
     *
     * @param wxAutoReply 微信自动回复
     * @return 结果
     */
    @Override
    public int insertWxAutoReply(WxAutoReply wxAutoReply) {
        wxAutoReply.setCreateTime(DateUtils.getNowDate());
        return wxAutoReplyMapper.insertWxAutoReply(wxAutoReply);
    }

    /**
     * 修改微信自动回复
     *
     * @param wxAutoReply 微信自动回复
     * @return 结果
     */
    @Override
    public int updateWxAutoReply(WxAutoReply wxAutoReply) {
        wxAutoReply.setUpdateTime(DateUtils.getNowDate());
        return wxAutoReplyMapper.updateWxAutoReply(wxAutoReply);
    }

    /**
     * 批量删除微信自动回复
     *
     * @param ids 需要删除的微信自动回复主键
     * @return 结果
     */
    @Override
    public int deleteWxAutoReplyByIds(String[] ids) {
        return wxAutoReplyMapper.deleteWxAutoReplyByIds(ids);
    }

    /**
     * 删除微信自动回复信息
     *
     * @param id 微信自动回复主键
     * @return 结果
     */
    @Override
    public int deleteWxAutoReplyById(String id) {
        return wxAutoReplyMapper.deleteWxAutoReplyById(id);
    }
}
